home *** CD-ROM | disk | FTP | other *** search
/ TPUG - Toronto PET Users Group / TPUG Users Group CD / TPUG Users Group CD.iso / AMIGA / AMICUS / AMICUS08.ADF / AmigaBasicProgs / Clue < prev    next >
Text File  |  1986-04-02  |  11KB  |  889 lines

  1.  REM Clue A Murder Mystery Game
  2.  
  3.  REM by Robert Shingledecker
  4.  
  5.  REM
  6.  
  7.  CLS
  8.  
  9.  true = 1
  10.  
  11.  false = 0
  12.  
  13.  GOSUB INITIALIZE.GAME
  14.  
  15.  GOSUB CLEAR.VARIABLES
  16.  
  17.  GOSUB main.menu
  18.  
  19.  GOSUB ESTABLISH.SUSPECTS.MOVEMENTS
  20.  
  21.  GOSUB ESTABLISH.MURDER.SETTING
  22.  
  23.  GOSUB Instructions
  24.  
  25.  WHILE case.solved = 0 AND give.up = 0 AND total.confronts < 3
  26.  
  27.    selection = MENU(0)
  28.  
  29.    IF selection = 1 THEN
  30.  
  31.      ON MENU(1) GOSUB Instructions, BLUEPRINT, Question, ACCUSE.suspect, check.time, check.room, Quit
  32.  
  33.    GOSUB main.menu
  34.  
  35.    END IF
  36.  
  37.  WEND  
  38.  
  39.  IF case.solved THEN
  40.  
  41.    GOSUB DISPLAY.SOLVED.MESSAGE
  42.  
  43.  ELSE
  44.  
  45.    GOSUB DISPLAY.ANSWER
  46.  
  47.  END IF
  48.  
  49.  MENU RESET
  50.  
  51.  STOP
  52.  
  53.   
  54.  
  55.  INITIALIZE.GAME:
  56.  
  57.    DIM suspect$(5)
  58.  
  59.    DIM POSITION(5,9)
  60.  
  61.    DIM room$(6)
  62.  
  63.    suspect$(1)="Trebor"
  64.  
  65.    suspect$(2)="Connie"
  66.  
  67.    suspect$(3)="Harv"
  68.  
  69.  
  70.    suspect$(4)="Shirley"
  71.  
  72.    suspect$(5)="Glenn"
  73.  
  74.    room$(1)="Living Room"
  75.  
  76.    room$(2)="Dining Room"
  77.  
  78.    room$(3)="Kitchen"
  79.  
  80.    room$(4)="Bedroom"
  81.  
  82.    room$(5)="Trophy Room"
  83.  
  84.    room$(6)="Garage"
  85.  
  86.    GOSUB CLEAR.VARIABLES
  87.  
  88.    RANDOMIZE TIMER
  89.  
  90.  RETURN
  91.  
  92.   
  93.  
  94.  BLUEPRINT:  
  95.  
  96.    CLS
  97.  
  98.    PRINT
  99.  
  100.    PRINT SPACE$(11),"***  CLUE - A Murder Mystery Game  ***"
  101.  
  102.    PRINT
  103.  
  104.    PRINT
  105.  
  106.    PRINT
  107.  
  108.    PRINT SPACE$(12),"************"
  109.  
  110.    PRINT SPACE$(12),"*          *"
  111.  
  112.    PRINT SPACE$(12),"*  Garage  *"
  113.  
  114.    PRINT SPACE$(12),"*          *"
  115.  
  116.    PRINT SPACE$(12),"****    ****              ***********"
  117.  
  118.    PRINT SPACE$(12),"*          *              *         *"
  119.  
  120.    PRINT SPACE$(12),"*  Trophy  *              * Living  *"
  121.  
  122.    PRINT SPACE$(12),"*          *              *         *"
  123.  
  124.    PRINT SPACE$(12),"****    *********************     ***"
  125.  
  126.    PRINT SPACE$(12),"*          *              *         *"
  127.  
  128.    PRINT SPACE$(12),"* Bedroom      Kitchen      Dining  *"
  129.  
  130.    PRINT SPACE$(12),"*          *              *         *"
  131.  
  132.    PRINT SPACE$(12),"*************************************"
  133.  
  134.  RETURN
  135.  
  136.   
  137.  
  138.  CLEAR.VARIABLES:  
  139.  
  140.    PRINT
  141.  
  142.    case.solved=false
  143.  
  144.    give.up=false
  145.  
  146.    no.more.accusations=false
  147.  
  148.    TOTAL.QUESTIONS=0
  149.  
  150.    total.confronts=0
  151.  
  152.    SOLVED.KILLER=false
  153.  
  154.    SOLVED.TIME=false
  155.  
  156.    SOLVED.ROOM=false
  157.  
  158.  RETURN
  159.  
  160.   
  161.  
  162.  ESTABLISH.SUSPECTS.MOVEMENTS:  
  163.  
  164.    GOSUB PLACE.SUSPECTS.IN.A.ROOM
  165.  
  166.    GOSUB ASSIGN.ROOMS.BY.TIME
  167.  
  168.  RETURN
  169.  
  170.   
  171.  
  172.  ESTABLISH.MURDER.SETTING:  
  173.  
  174.    murderer=INT(5*RND)+1
  175.  
  176.    hour.of.murder=INT(9*RND)+1
  177.  
  178.    place.of.murder=POSITION(murderer,hour.of.murder)
  179.  
  180.  RETURN
  181.  
  182.  
  183.  
  184.  Question:
  185.  
  186.    PRINT
  187.  
  188.    PRINT "Choose a SUSPECT!"
  189.  
  190.    GOSUB suspect.menu
  191.  
  192.    ss = 0
  193.  
  194.    WHILE ss = 0
  195.  
  196.      selection = MENU(0)
  197.  
  198.      IF selection = 1 THEN
  199.  
  200.        ss = MENU(1)
  201.  
  202.      END IF
  203.  
  204.    WEND
  205.  
  206.    IF ss = 6 THEN CLS: RETURN
  207.  
  208.    PRINT "What do you wish to question ";suspect$(ss);" about ?"
  209.  
  210.    PRINT "Now choose either WHERE IN or WHEN AT."
  211.  
  212.    GOSUB quest.menu
  213.  
  214.    sh = 0: sr = 0
  215.  
  216.    WHILE sh=0 AND sr=0
  217.  
  218.      selection = MENU(0)
  219.  
  220.      IF selection = 1 THEN
  221.  
  222.        sh = MENU(1)
  223.  
  224.      ELSEIF selection = 2 THEN
  225.  
  226.        sr = MENU(1)
  227.  
  228.      END IF
  229.  
  230.    WEND
  231.  
  232.    IF sh = 10 OR sr = 7 THEN CLS: RETURN
  233.  
  234.    IF sh THEN
  235.  
  236.      PRINT suspect$(ss); " where were you at "; sh; " pm ?"
  237.  
  238.      GOSUB suspects.whereabouts
  239.  
  240.    ELSE
  241.  
  242.      PRINT suspect$(ss); " when were you in the ";room$(sr); "?"
  243.  
  244.      GOSUB times.in.a.room
  245.  
  246.    END IF
  247.  
  248.  RETURN
  249.  
  250.    
  251.  
  252.  PLACE.SUSPECTS.IN.A.ROOM:  
  253.  
  254.    FOR SUSPECT.NBR=1 TO 5
  255.  
  256.      room.nbr=INT(6*RND)+1
  257.  
  258.      POSITION(SUSPECT.NBR,1)=room.nbr
  259.  
  260.    NEXT SUSPECT.NBR
  261.  
  262.  RETURN
  263.  
  264.   
  265.  
  266.  ASSIGN.ROOMS.BY.TIME:  
  267.  
  268.    FOR HOUR=2 TO 9
  269.  
  270.      FOR SUSPECT.NBR=1 TO 5
  271.  
  272.        PRIOR.HOUR=HOUR-1
  273.  
  274.        prior.room=POSITION(SUSPECT.NBR,PRIOR.HOUR)
  275.  
  276.        room.nbr = INT(6*RND)+1
  277.  
  278.        WHILE room.nbr = prior.room
  279.  
  280.          room.nbr=INT(6*RND)+1
  281.  
  282.        WEND
  283.  
  284.        POSITION(SUSPECT.NBR,HOUR)=room.nbr
  285.  
  286.      NEXT SUSPECT.NBR
  287.  
  288.    NEXT HOUR
  289.  
  290.  RETURN
  291.  
  292.     
  293.  
  294.  suspects.whereabouts:  
  295.  
  296.    TOTAL.QUESTIONS = TOTAL.QUESTIONS + 1
  297.  
  298.    room.nbr=POSITION(ss,sh)
  299.  
  300.    IF ss=murderer THEN room.nbr=INT(6*RND)+1
  301.  
  302.    IF room.nbr=place.of.murder THEN GOSUB GIVE.CLUE.ABOUT.TIME
  303.  
  304.    PRINT "I was in the ";room$(room.nbr)
  305.  
  306.    GOSUB SHOW.NEARBY.SUSPECTS
  307.  
  308.  RETURN
  309.  
  310.     
  311.  
  312.  GIVE.CLUE.ABOUT.TIME:  
  313.  
  314.    PRINT
  315.  
  316.    IF sh < hour.of.murder THEN
  317.  
  318.      PRINT "I was chatting with our host"
  319.  
  320.    ELSE
  321.  
  322.      PRINT "I found the host already dead"
  323.  
  324.    END IF
  325.  
  326.  RETURN
  327.  
  328.   
  329.  
  330.  SHOW.NEARBY.SUSPECTS:  
  331.  
  332.    FOR X=1 TO 5
  333.  
  334.      IF X<>ss THEN
  335.  
  336.        IF POSITION(X,sh)=room.nbr THEN
  337.  
  338.          PRINT "I was with ";suspect$(X)
  339.  
  340.        END IF
  341.  
  342.        IF ABS(POSITION(X,sh)-room.nbr)=1 THEN
  343.  
  344.          PRINT "I saw ";suspect$(X)
  345.  
  346.        END IF
  347.  
  348.      END IF
  349.  
  350.    NEXT X
  351.  
  352.  RETURN
  353.  
  354.   
  355.  
  356.  times.in.a.room:  
  357.  
  358.    TOTAL.QUESTIONS = TOTAL.QUESTIONS + 1
  359.  
  360.    IF ss = murderer THEN
  361.  
  362.      GOSUB LIE.ABOUT.TIME
  363.  
  364.    ELSE
  365.  
  366.      NEVER.THERE=true
  367.  
  368.      FOR X=1 TO 9
  369.  
  370.        GOSUB CHECK.THIS.ROOM
  371.  
  372.      NEXT X
  373.  
  374.      IF NEVER.THERE=true THEN PRINT "I was never in that room"
  375.  
  376.    END IF
  377.  
  378.  RETURN
  379.  
  380.   
  381.  
  382.  LIE.ABOUT.TIME:  
  383.  
  384.    FOR X=1 TO INT(2*RND)+1
  385.  
  386.      PRINT "I was there at ";INT(9*RND)+1
  387.  
  388.    NEXT X
  389.  
  390.  RETURN
  391.  
  392.   
  393.  
  394.  CHECK.THIS.ROOM:  
  395.  
  396.    IF POSITION(ss,X) = sr THEN
  397.  
  398.      PRINT "I was there at ";X
  399.  
  400.      NEVER.THERE=false
  401.  
  402.    END IF
  403.  
  404.  RETURN
  405.  
  406.   
  407.  
  408.  DISPLAY.ANSWER:
  409.  
  410.    CLS  
  411.  
  412.    PRINT
  413.  
  414.    IF total.confronts > 2 THEN
  415.  
  416.      PRINT "Sorry, you have exhausted all three"
  417.  
  418.      PRINT "of your accusations..."
  419.  
  420.      PRINT
  421.  
  422.    END IF
  423.  
  424.    PRINT
  425.  
  426.    PRINT "The murderer was ",suspect$(murderer)
  427.  
  428.    PRINT
  429.  
  430.    PRINT "The place was the ",room$(place.of.murder)
  431.  
  432.    PRINT
  433.  
  434.    PRINT "The time of the murder was ";hour.of.murder;" pm."
  435.  
  436.    PRINT
  437.  
  438.    PRINT "Better luck next time..."
  439.  
  440.    PRINT
  441.  
  442.  RETURN
  443.  
  444.     
  445.  
  446.  ACCUSE.suspect:  
  447.  
  448.    IF SOLVED.KILLER THEN
  449.  
  450.      PRINT "You already found the MURDERER... ":
  451.  
  452.      PRINT suspect$(murderer)
  453.  
  454.      PRINT
  455.  
  456.    ELSE
  457.  
  458.      PRINT
  459.  
  460.      PRINT "So you think you know the murderer..."
  461.  
  462.      GOSUB suspect.menu
  463.  
  464.      GOSUB pick.the.murderer
  465.  
  466.      IF ss=6 THEN CLS: RETURN
  467.  
  468.      PRINT
  469.  
  470.      PRINT suspect$(ss)
  471.  
  472.      IF ss = murderer THEN
  473.  
  474.        PRINT "Congratulations you found the murderer!"
  475.  
  476.        SOLVED.KILLER=true
  477.  
  478.        case.solved=SOLVED.KILLER AND SOLVED.ROOM AND SOLVED.TIME
  479.  
  480.      ELSE
  481.  
  482.        PRINT "First day on the job, kid!"
  483.  
  484.        total.confronts = total.confronts + 1
  485.  
  486.      END IF
  487.  
  488.    END IF
  489.  
  490.  RETURN
  491.  
  492.   
  493.  
  494.  pick.the.murderer:  
  495.  
  496.    PRINT
  497.  
  498.    PRINT "Who is the murderer ?"
  499.  
  500.    ss = 0
  501.  
  502.    WHILE ss=0
  503.  
  504.      selection = MENU(0)
  505.  
  506.      IF selection=1 THEN
  507.  
  508.        ss=MENU(1)
  509.  
  510.      END IF
  511.  
  512.    WEND
  513.  
  514.  RETURN
  515.  
  516.   
  517.  
  518.  check.room:  
  519.  
  520.    IF SOLVED.ROOM THEN
  521.  
  522.      PRINT "You already found the ROOM... ":
  523.  
  524.      PRINT room$(place.of.murder)
  525.  
  526.      PRINT
  527.  
  528.    ELSE
  529.  
  530.      PRINT
  531.  
  532.      PRINT "So you think you know the room..."
  533.  
  534.      PRINT "What room?"
  535.  
  536.      GOSUB room.menu
  537.  
  538.      GOSUB pick.a.room
  539.  
  540.      IF sr = 7 THEN CLS: RETURN
  541.  
  542.      PRINT room$(sr)
  543.  
  544.      IF sr = place.of.murder THEN
  545.  
  546.        PRINT "Congratulations you found the room!"
  547.  
  548.        SOLVED.ROOM=true
  549.  
  550.        case.solved=SOLVED.KILLER AND SOLVED.ROOM AND SOLVED.TIME
  551.  
  552.      ELSE
  553.  
  554.        PRINT "Not this room."
  555.  
  556.        total.confronts = total.confronts + 1
  557.  
  558.      END IF
  559.  
  560.    END IF
  561.  
  562.  RETURN
  563.  
  564.  
  565.  
  566.  pick.a.room:
  567.  
  568.    sr = 0
  569.  
  570.    WHILE sr = 0
  571.  
  572.      selection = MENU(0)
  573.  
  574.      IF selection = 1 THEN
  575.  
  576.        sr = MENU(1)
  577.  
  578.      END IF
  579.  
  580.    WEND
  581.  
  582.  RETURN
  583.  
  584.    
  585.  
  586.  check.time:  
  587.  
  588.    IF SOLVED.TIME THEN
  589.  
  590.      PRINT "You already found the TIME... ":
  591.  
  592.      PRINT hour.of.murder;" PM."
  593.  
  594.      PRINT
  595.  
  596.    ELSE
  597.  
  598.      PRINT
  599.  
  600.      PRINT "So you think you know the time... "
  601.  
  602.      PRINT "What time?"
  603.  
  604.      GOSUB time.menu
  605.  
  606.      GOSUB pick.time
  607.  
  608.      IF sh=10 THEN CLS: RETURN
  609.  
  610.      PRINT sh
  611.  
  612.      IF sh = hour.of.murder THEN
  613.  
  614.        PRINT "Congratulations you found the time!"
  615.  
  616.        SOLVED.TIME=true
  617.  
  618.        case.solved=SOLVED.KILLER AND SOLVED.ROOM AND SOLVED.TIME
  619.  
  620.      ELSE
  621.  
  622.        total.confronts = total.confronts + 1
  623.  
  624.        IF ABS(sh - hour.of.murder)>2 THEN
  625.  
  626.          PRINT "Not even close..."
  627.  
  628.        ELSE
  629.  
  630.          PRINT "Your getting warm..."
  631.  
  632.        END IF
  633.  
  634.      END IF
  635.  
  636.    END IF
  637.  
  638.  RETURN
  639.  
  640.  
  641.  
  642.  pick.time:
  643.  
  644.    sh = 0
  645.  
  646.    WHILE sh = 0
  647.  
  648.      selection = MENU(0)
  649.  
  650.      IF selection = 1 THEN
  651.  
  652.        sh = MENU(1)
  653.  
  654.      END IF
  655.  
  656.    WEND
  657.  
  658.  RETURN
  659.  
  660.   
  661.  
  662.  DISPLAY.SOLVED.MESSAGE:  
  663.  
  664.    PRINT
  665.  
  666.    PRINT "Congratulations..."
  667.  
  668.    PRINT "It took only ";TOTAL.QUESTIONS;" questions to solve this case."
  669.  
  670.    PRINT
  671.  
  672.    PRINT "Have a nice day..."
  673.  
  674.  RETURN
  675.  
  676.  
  677.  
  678.  Quit:
  679.  
  680.    give.up = true
  681.  
  682.  RETURN
  683.  
  684.   
  685.  
  686.  Instructions:
  687.  
  688.    CLS
  689.  
  690.    PRINT  
  691.  
  692.    PRINT TAB(11)," *** CLUE - A Murder Mystery Game ***"
  693.  
  694.    PRINT
  695.  
  696.    PRINT "The facts are:"
  697.  
  698.    PRINT
  699.  
  700.    PRINT " 1. The host of a party was murdered."
  701.  
  702.    PRINT " 2. The murder occured in one of the rooms shown in the blueprint."
  703.  
  704.    PRINT " 3. The murder occured between 1 and 9 pm, and on the hour!"
  705.  
  706.    PRINT " 4. You will be told who was present in the house."
  707.  
  708.    PRINT " 5. The guests move from room to room, but the host doesn't."
  709.  
  710.    PRINT " 6. 'WHERE AT' type questions give more information than 'WHEN IN'. "
  711.  
  712.    PRINT
  713.  
  714.    PRINT "You are to determine the murderer, time of murder, and the room."
  715.  
  716.    PRINT "Ask questions of the suspects and analyze them..."
  717.  
  718.    PRINT
  719.  
  720.    PRINT "The murderer will probably tell a lie. When a suspect is in the murder"
  721.  
  722.    PRINT "room you will be given additional information.  When a suspect says "
  723.  
  724.    PRINT "they saw another suspect, that means the other suspect must be in an"
  725.  
  726.    PRINT "ADJACENT room, (see blueprint), or someone is lying."
  727.  
  728.    PRINT 
  729.  
  730.    PRINT "You are allowed only three incorrect accusations so be careful!"
  731.  
  732.    PRINT 
  733.  
  734.    PRINT "      No keyboarding required, use MOUSE.   Good luck!"
  735.  
  736.  RETURN
  737.  
  738.  
  739.  
  740.  main.menu:
  741.  
  742.    MENU 1,0,1,"PROJECT"
  743.  
  744.    MENU 1,1,1,"Instructions"
  745.  
  746.    MENU 1,2,1,"Blueprint"
  747.  
  748.    MENU 1,3,1,"Ask Question"
  749.  
  750.    MENU 1,4,1,"Accuse Suspect"
  751.  
  752.    MENU 1,5,1,"Accusation Time"
  753.  
  754.    MENU 1,6,1,"Accusation Room"
  755.  
  756.    MENU 1,7,1,"Quit"
  757.  
  758.    MENU 2,0,0,""
  759.  
  760.    MENU 3,0,0,""
  761.  
  762.    MENU 4,0,0,""
  763.  
  764.  RETURN
  765.  
  766.  
  767.  
  768.  suspect.menu:
  769.  
  770.    MENU 1,0,1,"SUSPECTS"
  771.  
  772.    MENU 1,1,1,"Trebor"
  773.  
  774.    MENU 1,2,1,"Connie"
  775.  
  776.    MENU 1,3,1,"Harv"
  777.  
  778.    MENU 1,4,1,"Shirley"
  779.  
  780.    MENU 1,5,1,"Glenn"
  781.  
  782.    MENU 1,6,1,"NONE"
  783.  
  784.  RETURN
  785.  
  786.  
  787.  
  788.  time.menu:
  789.  
  790.    MENU 1,0,1,"TIMES"
  791.  
  792.    MENU 1,1,1,"1 pm"
  793.  
  794.    MENU 1,2,1,"2 pm"
  795.  
  796.    MENU 1,3,1,"3 pm"
  797.  
  798.    MENU 1,4,1,"4 pm"
  799.  
  800.    MENU 1,5,1,"5 pm"
  801.  
  802.    MENU 1,6,1,"6 pm"
  803.  
  804.    MENU 1,7,1,"7 pm"
  805.  
  806.    MENU 1,8,1,"8 pm"
  807.  
  808.    MENU 1,9,1,"9 pm"
  809.  
  810.    MENU 1,10,1,"NONE"
  811.  
  812.  RETURN
  813.  
  814.  
  815.  
  816.  room.menu:
  817.  
  818.    MENU 1,0,1,"ROOMS"
  819.  
  820.    MENU 1,1,1,"Living Room"
  821.  
  822.    MENU 1,2,1,"Dining Room"
  823.  
  824.    MENU 1,3,1,"Kitchen"
  825.  
  826.    MENU 1,4,1,"Bedroom"
  827.  
  828.    MENU 1,5,1,"Trophy Room"
  829.  
  830.    MENU 1,6,1,"Garage"
  831.  
  832.    MENU 1,7,1,"NONE" 
  833.  
  834.  RETURN
  835.  
  836.  
  837.  
  838.  quest.menu:
  839.  
  840.    MENU 1,0,1,"WHERE AT"
  841.  
  842.    MENU 1,1,1,"1 pm"
  843.  
  844.    MENU 1,2,1,"2 pm"
  845.  
  846.    MENU 1,3,1,"3 pm"
  847.  
  848.    MENU 1,4,1,"4 pm"
  849.  
  850.    MENU 1,5,1,"5 pm"
  851.  
  852.    MENU 1,6,1,"6 pm"
  853.  
  854.    MENU 1,7,1,"7 pm"
  855.  
  856.    MENU 1,8,1,"8 pm"
  857.  
  858.    MENU 1,9,1,"9 pm"
  859.  
  860.    MENU 1,10,1,"NONE"
  861.  
  862.    MENU 2,0,1,"WHEN IN"
  863.  
  864.    MENU 2,1,1,"Living Room"
  865.  
  866.    MENU 2,2,1,"Dining Room"
  867.  
  868.    MENU 2,3,1,"Kitchen"
  869.  
  870.    MENU 2,4,1,"Bedroom"
  871.  
  872.    MENU 2,5,1,"Trophy Room"
  873.  
  874.    MENU 2,6,1,"Garage"
  875.  
  876.    MENU 2,7,1,"NONE"
  877.  
  878.  RETURN  
  879.  
  880.   
  881.  
  882.  END
  883.  
  884.  
  885. /END
  886.  
  887.  
  888.  
  889.